{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from pandas.tseries.offsets import Day, MonthEnd\n",
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01-01</th>\n",
       "      <td>1969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-02</th>\n",
       "      <td>9392</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-03</th>\n",
       "      <td>5406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-04</th>\n",
       "      <td>8386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-05</th>\n",
       "      <td>5919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-02-28</th>\n",
       "      <td>6313</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-01</th>\n",
       "      <td>9866</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-02</th>\n",
       "      <td>7541</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-03</th>\n",
       "      <td>7174</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-04</th>\n",
       "      <td>6856</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>794 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             销售额\n",
       "日期              \n",
       "2019-01-01  1969\n",
       "2019-01-02  9392\n",
       "2019-01-03  5406\n",
       "2019-01-04  8386\n",
       "2019-01-05  5919\n",
       "...          ...\n",
       "2021-02-28  6313\n",
       "2021-03-01  9866\n",
       "2021-03-02  7541\n",
       "2021-03-03  7174\n",
       "2021-03-04  6856\n",
       "\n",
       "[794 rows x 1 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 读取数据集，\n",
    "df = pd.read_excel('./data.xlsx',sheet_name='Sheet2')\n",
    "df['日期'] = pd.to_datetime(df['日期']) # 将数据类型转换为日期类型\n",
    "df = df.set_index('日期') # 将日期类型设置为索引\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01-01</th>\n",
       "      <td>1969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-02</th>\n",
       "      <td>9392</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-03</th>\n",
       "      <td>5406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-04</th>\n",
       "      <td>8386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-05</th>\n",
       "      <td>5919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-12-27</th>\n",
       "      <td>1513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-12-28</th>\n",
       "      <td>4537</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-12-29</th>\n",
       "      <td>2100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-12-30</th>\n",
       "      <td>7941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-12-31</th>\n",
       "      <td>1081</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>731 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             销售额\n",
       "日期              \n",
       "2019-01-01  1969\n",
       "2019-01-02  9392\n",
       "2019-01-03  5406\n",
       "2019-01-04  8386\n",
       "2019-01-05  5919\n",
       "...          ...\n",
       "2020-12-27  1513\n",
       "2020-12-28  4537\n",
       "2020-12-29  2100\n",
       "2020-12-30  7941\n",
       "2020-12-31  1081\n",
       "\n",
       "[731 rows x 1 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按日期筛选数据\n",
    "df_2019_2020 = df['2019':'2020']\n",
    "df_2019_2020"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-11-01</th>\n",
       "      <td>3991</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-02</th>\n",
       "      <td>4227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-03</th>\n",
       "      <td>8202</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-04</th>\n",
       "      <td>5642</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-05</th>\n",
       "      <td>3066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-06</th>\n",
       "      <td>1875</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-07</th>\n",
       "      <td>4210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-08</th>\n",
       "      <td>5595</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-09</th>\n",
       "      <td>4717</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-10</th>\n",
       "      <td>4123</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-11</th>\n",
       "      <td>7066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-12</th>\n",
       "      <td>4746</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-13</th>\n",
       "      <td>6801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-14</th>\n",
       "      <td>6645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-15</th>\n",
       "      <td>5131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-16</th>\n",
       "      <td>8131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-17</th>\n",
       "      <td>8121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-18</th>\n",
       "      <td>2485</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-19</th>\n",
       "      <td>1388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-20</th>\n",
       "      <td>4308</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-21</th>\n",
       "      <td>2639</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-22</th>\n",
       "      <td>9613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-23</th>\n",
       "      <td>7832</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-24</th>\n",
       "      <td>8307</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-25</th>\n",
       "      <td>4986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-26</th>\n",
       "      <td>3240</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-27</th>\n",
       "      <td>7037</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-28</th>\n",
       "      <td>9361</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-29</th>\n",
       "      <td>8604</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-30</th>\n",
       "      <td>2308</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             销售额\n",
       "日期              \n",
       "2019-11-01  3991\n",
       "2019-11-02  4227\n",
       "2019-11-03  8202\n",
       "2019-11-04  5642\n",
       "2019-11-05  3066\n",
       "2019-11-06  1875\n",
       "2019-11-07  4210\n",
       "2019-11-08  5595\n",
       "2019-11-09  4717\n",
       "2019-11-10  4123\n",
       "2019-11-11  7066\n",
       "2019-11-12  4746\n",
       "2019-11-13  6801\n",
       "2019-11-14  6645\n",
       "2019-11-15  5131\n",
       "2019-11-16  8131\n",
       "2019-11-17  8121\n",
       "2019-11-18  2485\n",
       "2019-11-19  1388\n",
       "2019-11-20  4308\n",
       "2019-11-21  2639\n",
       "2019-11-22  9613\n",
       "2019-11-23  7832\n",
       "2019-11-24  8307\n",
       "2019-11-25  4986\n",
       "2019-11-26  3240\n",
       "2019-11-27  7037\n",
       "2019-11-28  9361\n",
       "2019-11-29  8604\n",
       "2019-11-30  2308"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_201911 = df.loc['2019-11']\n",
    "df_201911"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-11-06</th>\n",
       "      <td>1875</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-07</th>\n",
       "      <td>4210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-08</th>\n",
       "      <td>5595</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-11-09</th>\n",
       "      <td>4717</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             销售额\n",
       "日期              \n",
       "2019-11-06  1875\n",
       "2019-11-07  4210\n",
       "2019-11-08  5595\n",
       "2019-11-09  4717"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_11 = df['2019-11-06':'2019-11-09']\n",
    "df_11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-12-31</th>\n",
       "      <td>1081</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>4579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2806</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>6097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>4837</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-02-28</th>\n",
       "      <td>6313</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-01</th>\n",
       "      <td>9866</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-02</th>\n",
       "      <td>7541</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-03</th>\n",
       "      <td>7174</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-03-04</th>\n",
       "      <td>6856</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>64 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             销售额\n",
       "日期              \n",
       "2020-12-31  1081\n",
       "2021-01-01  4579\n",
       "2021-01-02  2806\n",
       "2021-01-03  6097\n",
       "2021-01-04  4837\n",
       "...          ...\n",
       "2021-02-28  6313\n",
       "2021-03-01  9866\n",
       "2021-03-02  7541\n",
       "2021-03-03  7174\n",
       "2021-03-04  6856\n",
       "\n",
       "[64 rows x 1 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_after = df.truncate(before = '2020-12-31')\n",
    "df_after"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01-01</th>\n",
       "      <td>1969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-02</th>\n",
       "      <td>9392</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-03</th>\n",
       "      <td>5406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-04</th>\n",
       "      <td>8386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-05</th>\n",
       "      <td>5919</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             销售额\n",
       "日期              \n",
       "2019-01-01  1969\n",
       "2019-01-02  9392\n",
       "2019-01-03  5406\n",
       "2019-01-04  8386\n",
       "2019-01-05  5919"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_before = df.truncate(after = '2019-01-05')\n",
    "df_before"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01</th>\n",
       "      <td>1969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01</th>\n",
       "      <td>9392</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01</th>\n",
       "      <td>5406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01</th>\n",
       "      <td>8386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01</th>\n",
       "      <td>5919</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          销售额\n",
       "日期           \n",
       "2019-01  1969\n",
       "2019-01  9392\n",
       "2019-01  5406\n",
       "2019-01  8386\n",
       "2019-01  5919"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按日期显示数据\n",
    "df.to_period('M').head() #按月显示，但不统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019Q1</th>\n",
       "      <td>1969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019Q1</th>\n",
       "      <td>9392</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019Q1</th>\n",
       "      <td>5406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019Q1</th>\n",
       "      <td>8386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019Q1</th>\n",
       "      <td>5919</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         销售额\n",
       "日期          \n",
       "2019Q1  1969\n",
       "2019Q1  9392\n",
       "2019Q1  5406\n",
       "2019Q1  8386\n",
       "2019Q1  5919"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_period('Q').head() #按季度显示，但不统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019</th>\n",
       "      <td>1969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019</th>\n",
       "      <td>9392</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019</th>\n",
       "      <td>5406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019</th>\n",
       "      <td>8386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019</th>\n",
       "      <td>5919</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       销售额\n",
       "日期        \n",
       "2019  1969\n",
       "2019  9392\n",
       "2019  5406\n",
       "2019  8386\n",
       "2019  5919"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_period('A').head() #按年显示，但不统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01-06</th>\n",
       "      <td>36644</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-13</th>\n",
       "      <td>31355</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-20</th>\n",
       "      <td>32744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-01-27</th>\n",
       "      <td>44856</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-02-03</th>\n",
       "      <td>38589</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              销售额\n",
       "日期               \n",
       "2019-01-06  36644\n",
       "2019-01-13  31355\n",
       "2019-01-20  32744\n",
       "2019-01-27  44856\n",
       "2019-02-03  38589"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按周统计数据\n",
    "df.resample('w').sum().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01-31</th>\n",
       "      <td>172438</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-02-28</th>\n",
       "      <td>157429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-03-31</th>\n",
       "      <td>190439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-04-30</th>\n",
       "      <td>161940</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-05-31</th>\n",
       "      <td>168406</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               销售额\n",
       "日期                \n",
       "2019-01-31  172438\n",
       "2019-02-28  157429\n",
       "2019-03-31  190439\n",
       "2019-04-30  161940\n",
       "2019-05-31  168406"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按月统计数据\n",
    "df.resample('M').sum().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-03-31</th>\n",
       "      <td>520306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-06-30</th>\n",
       "      <td>520138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-09-30</th>\n",
       "      <td>557186</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-12-31</th>\n",
       "      <td>537313</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-03-31</th>\n",
       "      <td>492765</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               销售额\n",
       "日期                \n",
       "2019-03-31  520306\n",
       "2019-06-30  520138\n",
       "2019-09-30  557186\n",
       "2019-12-31  537313\n",
       "2020-03-31  492765"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按季度统计数据\n",
    "df.resample('Q').sum().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01-01</th>\n",
       "      <td>2134943</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-01-01</th>\n",
       "      <td>2034433</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>339931</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                销售额\n",
       "日期                 \n",
       "2019-01-01  2134943\n",
       "2020-01-01  2034433\n",
       "2021-01-01   339931"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按年统计数据\n",
    "df.resample('AS').sum().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019</th>\n",
       "      <td>2134943</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020</th>\n",
       "      <td>2034433</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021</th>\n",
       "      <td>339931</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          销售额\n",
       "日期           \n",
       "2019  2134943\n",
       "2020  2034433\n",
       "2021   339931"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按年统计并显示\n",
    "df.resample('AS').sum().to_period('A').head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019Q1</th>\n",
       "      <td>520306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019Q2</th>\n",
       "      <td>520138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019Q3</th>\n",
       "      <td>557186</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019Q4</th>\n",
       "      <td>537313</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020Q1</th>\n",
       "      <td>492765</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           销售额\n",
       "日期            \n",
       "2019Q1  520306\n",
       "2019Q2  520138\n",
       "2019Q3  557186\n",
       "2019Q4  537313\n",
       "2020Q1  492765"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按季度统计并显示\n",
    "df.resample('Q').sum().to_period('Q').head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销售额</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2019-01</th>\n",
       "      <td>172438</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-02</th>\n",
       "      <td>157429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-03</th>\n",
       "      <td>190439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-04</th>\n",
       "      <td>161940</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019-05</th>\n",
       "      <td>168406</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            销售额\n",
       "日期             \n",
       "2019-01  172438\n",
       "2019-02  157429\n",
       "2019-03  190439\n",
       "2019-04  161940\n",
       "2019-05  168406"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按月度统计并显示\n",
    "df.resample('M').sum().to_period('M').head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2021-03-01', '2021-03-02', '2021-03-03', '2021-03-04'], dtype='datetime64[ns]', freq='D')"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 创建日期索引\n",
    "# 默认产生按天计算的时间点\n",
    "index = pd.date_range('2021-03-01', '2021-03-04')\n",
    "index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2021-01-01', '2021-01-04', '2021-01-05', '2021-01-06',\n",
       "               '2021-01-07', '2021-01-08', '2021-01-11', '2021-01-12',\n",
       "               '2021-01-13', '2021-01-14'],\n",
       "              dtype='datetime64[ns]', freq='B')"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按工作日计算产生对应日期\n",
    "index2 = pd.date_range('20210101',periods=10,freq='B')\n",
    "index2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2021-02-28', '2021-03-31', '2021-04-30', '2021-05-31',\n",
       "               '2021-06-30', '2021-07-31', '2021-08-31', '2021-09-30',\n",
       "               '2021-10-31', '2021-11-30'],\n",
       "              dtype='datetime64[ns]', freq='M')"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按每月最后一天产生对应日期\n",
    "index3 = pd.date_range('2021/02/01',periods=10,freq='M')\n",
    "index3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2020-12-01', '2020-12-02', '2020-12-03', '2020-12-04',\n",
       "               '2020-12-05', '2020-12-06', '2020-12-07', '2020-12-08',\n",
       "               '2020-12-09', '2020-12-10', '2020-12-11', '2020-12-12',\n",
       "               '2020-12-13', '2020-12-14', '2020-12-15'],\n",
       "              dtype='datetime64[ns]', freq='D')"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 传入起始日期\n",
    "pd.date_range(start='2020-12-01', periods=15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2021-02-15', '2021-02-16', '2021-02-17', '2021-02-18',\n",
       "               '2021-02-19', '2021-02-20', '2021-02-21', '2021-02-22',\n",
       "               '2021-02-23', '2021-02-24', '2021-02-25', '2021-02-26',\n",
       "               '2021-02-27', '2021-02-28', '2021-03-01'],\n",
       "              dtype='datetime64[ns]', freq='D')"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 传入的结束日期带有时间信息，设置normalize=true，生成规范化的日期索引\n",
    "pd.date_range(end='2021-03-01 13:37:00',periods=15,normalize=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2021-01-29', '2021-02-26'], dtype='datetime64[ns]', freq='BM')"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 根据指定频率,生成一个由每月最后一个工作日组成的日期索引\n",
    "pd.date_range('2021-01-01', '2021-03-01', freq='BM')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2021-02-27 00:00:00')"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 向前位移 5 天\n",
    "now = datetime.datetime(2021, 3, 4)\n",
    "now  - 5 * Day()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2021-03-31 00:00:00')"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 向后位移到月底\n",
    "now + MonthEnd()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 时间序列的基础频率\n",
    "\n",
    "|别名|偏移量类型|说明\n",
    "|  ----  | ----  |  ----  |\n",
    "|D|Day|每日历日|\n",
    "|B|BusinessDay|每工作日|\n",
    "|H|Hour|每小时|\n",
    "|T/min|Minute|每分|\n",
    "|S|Second|每秒|\n",
    "|L/ms|Million|每毫秒|\n",
    "|U|Micro|每微妙|\n",
    "|M|MonthEnd|每月最后一个日历日|\n",
    "|BM|BusinessMonthEnd|每月最后一个工作日|\n",
    "|MS|MonthBegin|每月第一个日历日|\n",
    "|BMS|BusinessMonthBegi|每月第一个工作日|\n",
    "|W-MON、W-TUE…|Week|从指定的星期几开始算起，每周|\n",
    "|WOM-1MON、WOM-2MON…|WeekOfMonth|产生每月第一、二、三、四周的星期几，例如WOM-1MON表示每月的第一个星期一|\n",
    "|Q-JAN、Q-FEB…|QuarterEnd|对于以指定月份（JAN、FEB、…、DEC）结束的年度，每季度的最后一月的最后一个日历日|\n",
    "|BQ-JAN、BQ-FEB…|BusinessQuarterEnd|对于以指定月份（JAN、FEB、…、DEC）结束的年度，每季度的最后一月的最后一个工作日|\n",
    "|QS-JAN、QS-FEB…|QuarterBegin|对于以指定月份（JAN、FEB、…、DEC）结束的年度，每季度的最后一月的第一个日历日|\n",
    "|BQS-JAN、BQS-FEB…|BusinessQuarterBegin|对于以指定月份（JAN、FEB、…、DEC）结束的年度，每季度的最后一月的第一个工作日|\n",
    "|A-JAN、A-FEB…|YearEnd|每年指定月份最后一个日历日|\n",
    "|BA-JAN、BA-FEB…|BusinessYearEnd|每年指定月份最后一个工作日|\n",
    "|AS-JAN、AS-FEB…|YearBegin|每月指定月份第一个日历日|\n",
    "|BAS-JAN、BAS-FEB…|BusinessYearBegin|每月指定月份第一个工作日|"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
